package huan3;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import org.junit.Test;

public class OtherStreamTest {

	@Test
	public void test1() {
		  BufferedReader br = null;
	        try {
	            InputStreamReader isr = new InputStreamReader(System.in);
	            br = new BufferedReader(isr);

	            while (true) {
	                System.out.println("请输入字符串：");
	                String data = br.readLine();
	                if ("e".equalsIgnoreCase(data) || "exit".equalsIgnoreCase(data)) {
	                    System.out.println("程序结束");
	                    break;
	                }

	                String upperCase = data.toUpperCase();
	                System.out.println(upperCase);

	            }
	        } catch (IOException e) {
	            e.printStackTrace();
	        } finally {
	            if (br != null) {
	                try {
	                    br.close();
	                } catch (IOException e) {
	                    e.printStackTrace();
	                }

	            }
	        }
	    }

	
}
